package com.boyunv.visitor.example01;
/*
 *@description
 *
 *@author boyunv
 *@create 2023/9/3 9:22
 *@version 1.0
 */

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDate;

public class Fruit extends Product implements Acceptable{
    
    @Setter
    @Getter
    private double weight;
    
    public Fruit(String name, LocalDate producedDate, double price) {
        super(name, producedDate, price);
    }
    
    public Fruit(String name, LocalDate producedDate, double price, double weight) {
        super(name, producedDate, price);
        this.weight = weight;
    }
    @Override
    public void accept(Visitor visitor) {
        //accept方法中调用访问者,并将this传递回去
        visitor.visit(this);
        
    }
}
